package com.example.administrator.jinagsu2021_2;

import android.content.Context;
import android.content.SharedPreferences;

import java.util.HashMap;
import java.util.Map;

public class SaveandGet {
    public static boolean save(String maxtemp,String maxhum,Context context){
        SharedPreferences sp= context.getSharedPreferences("data.xml",Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = sp.edit();
        edit.putString("maxtemp",maxtemp);
        edit.putString("maxhum",maxhum);
        edit.commit();
        return true;
    }
    public static Map<String,String> get(Context context){
        SharedPreferences sp=context.getSharedPreferences("data.xml",Context.MODE_PRIVATE);
        String maxtemp = sp.getString("maxtemp", null);
        String maxhum = sp.getString("maxhum", null);
        Map<String,String> map=new HashMap<>();
        map.put("maxtemp",maxtemp);
        map.put("maxhum",maxhum);
        return map;
    }
    public static boolean saveAcc(String acc,Context context){
        SharedPreferences sp= context.getSharedPreferences("data.xml",Context.MODE_PRIVATE);
        SharedPreferences.Editor edit = sp.edit();
        edit.putString("acc",acc);
        edit.commit();
        return true;
    }


    public static String getacc(Context context){
        SharedPreferences sp=context.getSharedPreferences("data.xml",Context.MODE_PRIVATE);
        String acc = sp.getString("acc", null);
        return acc;
    }
}
